import { request } from "@/utils/request";
import type { IResponse } from ".";

const PREFIX = "/chat";
const PREFIX_CHAT_LOGIN = "/chat/copilotLogin"
interface Ilogin {
    account: string
    password: string
}
interface IRloginResp {
    "token": string
    "phone": string,
    "id": string,
    "isNewUser": string,
    "uid": string,
    "name": string
    userName: string
}

export function login(params: Partial<Ilogin>) {
	return request<IResponse<IRloginResp>>({
		method: "get",
		url: `${PREFIX}/copilotLogin/admin/login`,
    params
	});
}

interface ILogoutParams {
    token?: string
}

export function logout() {
    return request<IResponse>({
		method: "get",
		url: `${PREFIX_CHAT_LOGIN}/loginOut`
	});
}

export function apiAdminLogout() {
    return request<IResponse>({
		method: "get",
		url: `${PREFIX_CHAT_LOGIN}/admin/loginOut`
	});
}